// js实现动态变化的数字
const directive = {
  inserted(el, binding) {
    // 获取到需要动态变化的数值
    let finalNum = el.innerText; let count = 0; let timer = setInterval(() => {
      count++; el.innerText = count; if (count > finalNum) {
        //避免count大于finalNum最终数字显示不对
        count = finalNum; el.innerText = count;// 清空定时器
        clearInterval(timer); timer = null;
      }
    }, 100);
  },
};
export default directive;
